<template>
  <view class="feedback-card"  :style="{borderRadius:row.suggestionStatus === '1'?'0 0 8px 8px':'8px'}">
    <view class="feedback-top">
      <!-- 卡片头部 -->
      <view class="card-header">
        <text class="title">{{ row.suggestionTitle }}</text>
        <view :class="['status-tag', getStatusClass]">{{ getStatusText }}</view>
      </view>

      <!-- 标签 -->
      <view class="tag-wrapper">
        <article-tag :text="suggestionName"/>
      </view>

      <!-- 内容 -->
      <view class="content">内容:{{ row.suggestionContent }}</view>

       

      <!-- 时间列表 -->
      <view class="time-list">
        <view class="time-item">
          <text class="time">{{ row.createTime }}</text>
        </view>
      </view>
    </view>
    <view class="feedback-bottom" v-if="row.suggestionStatus === '1'">
      <view class="content">{{ row.suggestionFeedback }}</view>
      <view class="time-item">
        <text class="time">{{ row.updateTime }}</text>
      </view>
    </view>
  </view>
</template>

<script>
import ArticleTag from "../../../components/ArticleTag.vue";
export default {
  name: 'FeedbackCard',
  components:{ArticleTag},
  props: {
    row: {
      type: Object,
      required: true,
      default: () => ({})
    },
    typeList: {
      type: Array,
      default: () => ([])
    }
  },
  computed: {
    // 状态样式类
    getStatusClass() {
      const statusMap = {
        '0': 'status-processing',
        '1': 'status-finished'
      }
      return statusMap[this.row.suggestionStatus] || ''
    },
    // 状态文本
    getStatusText() {
      const statusMap = {
        '0': '处理中',
        '1': '已完成'
      }
      return statusMap[this.row.suggestionStatus] || ''
    },
    suggestionName(){
      let map = this.typeList.find(item=>item.value === this.row.suggestionType)
      return map && map.text
    }
  }
}
</script>

<style lang="scss" scoped>
.feedback-card {
  background-color:$uni-color-success;
  border-radius: 8px 8px 0 0;
  margin-bottom: 14px;
  .feedback-top{
    padding: 12px;
  }
  .feedback-bottom{
    padding: 12px;
    border-radius:0 0 8px 8px;
    background-color:#dee9e3;
  }
  // 卡片头部
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;

    .title {
      font-size: 17px;
      color:$uni-color-primary;
      font-weight: bold;
    }

    .status-tag {
      padding: 4px 8px;
      border-radius: 4px;
      font-size: 12px;

      &.status-processing {
        background-color: #c8d6cf;
        color: #333333;
      }

      &.status-finished {
        //渐变色
        background: #66c2ff;
        color: #F8E4A7;
      }
    }
  }

  // 标签样式
  .tag-wrapper {
    margin-bottom: 12px;

    .tag {
      display: inline-block;
      padding: 4px 12px;
      background-color: #68a67d;
      color: #fff;
      border-radius: 4px;
      font-size: 12px;
    }
  }

  // 内容样式
  .content {
    color: #333;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 4px;
  }

  .time-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;

    &:last-child {
      margin-bottom: 0;
    }
    .time {
      color: #999;
      font-size: 13px;
    }
  }
}
</style>
